import request from '@/utils/request.js'
import { useUserStore } from '@/stores'
const userStore = useUserStore()
//注册接口
export const userRegisterService = (obj) => {
  console.log('json化以后是:')
  console.log(JSON.stringify(obj))
  return request.post('user/register', JSON.stringify(obj))
}

//登录接口
export const userLoginService = (obj) => {
  return request.post('user/login', JSON.stringify(obj))
}

// 获取用户基本信息
export const userGetInfoService = () => {
  console.log('-----------------获取个人信息' + userStore.userName)
  //return request.get('/user/info', JSON.stringify(userStore.userName))
  return request.get(`/user/info?username=${userStore.userName}`)
}

// 获取全部注册用户
export const userGetRegisterService = () => {
  //console.log('-----------------注册的用户的信息' + userStore.userName)
  return request.get(`/user`)
}
